﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="StockAccount.ascx.cs"
    Inherits="TCKQKL.FrontEnd.Web.Controls.Portfolio" %>
<link href="../styles/data.css" rel="stylesheet" type="text/css" />
<%@ Import Namespace="TCKQKL.FrontEnd.DataModel" %>
<%@ Import Namespace="TCKQKL.FrontEnd.Config" %>
<table class="data" style="border:none;">
    <% if (holdings != null)
           if (holdings.Holding.Count > 0)
           {%>
    <tr>
        <td class="OrderAlertMessageStyle" colspan="8">
            <img alt="portfolio" src="./Images/portfolio.png" 
                style="width: 25px; height: 25px" />DANH MỤC ĐẦU TƯ
        </td>
    </tr>
    <tr>
        <th class="InnerHeading">
            Symbol
        </th>
        <th class="InnerHeading">
            Trading Qtty
        </th>
        <th class="InnerHeading">
            Netting Qtty
        </th>
        <th class="InnerHeading">
            Locked Qtty
        </th>
        <th class="InnerHeading">
            Average Price
        </th>
        <th class="InnerHeading">
            Market Price
        </th>
        <th class="InnerHeading">
            Changed
        </th>
        <th class="InnerHeading">
            Gain/Loss
        </th>
    </tr>
    <%for (int i = 0; i < holdings.Holding.Count; i++)
      { %>
    <tr>
        <td class="InnerData">
            <div title="<%=holdings.Holding[i].Quotes.CompanyName%>">
                <%=holdings.Holding[i].Quotes.Symbol%></div>
        </td>
        <td class="InnerData">
            <%=holdings.Holding[i].Account.tradingAmount%>
        </td>
        <td class="InnerData">
            <%=holdings.Holding[i].Account.nettingAmount%>
        </td>
        <td class="InnerData">
            <%=holdings.Holding[i].Account.lockedAmount%>
        </td>
        <td class="InnerData" style="text-align: right">
            <%=holdings.Holding[i].AverageBought.ToString("N")%>
        </td>
        <td class="InnerData">
            <%=holdings.Holding[i].Quotes.Closed %>
        </td>
        <td class="InnerData">
            <%=((holdings.Holding[i].Quotes.Closed - holdings.Holding[i].AverageBought) < 0) ? "<span style=\"color: red;\">" + String.Format("{0:n}", holdings.Holding[i].Quotes.Closed - holdings.Holding[i].AverageBought) + "▼</span>" : "<span style=\"color: green;\">" + String.Format("{0:n}", holdings.Holding[i].Quotes.Closed - holdings.Holding[i].AverageBought) + "▲</span>"%>
        </td>
        <td class="Master" style="text-align: right">
            <%=(holdings.Holding[i].Gain < 0) ? "<span style=\"color: red;\">" + String.Format("{0:0,0}", holdings.Holding[i].Gain * 1000) + "</span>" : "<span style=\"color: green;\">" + String.Format("{0:0,0}", holdings.Holding[i].Gain * 1000) + "</span>"%>
        </td>
    </tr>
    <%}%>
    <tr>
        <th class="InnerData">
            Subtotal:
        </th>
        <th class="InnerData">
            <%=String.Format("{0:0,0}", holdings.TradingValue)%>
        </th>
        <th class="InnerData">
            <%=String.Format("{0:0,0}", holdings.NettingValue)%>
        </th>
        <th class="InnerData">
            <%=String.Format("{0:0,0}", holdings.LockedValue)%>
        </th>
        <th class="InnerData" colspan="2">
            Total value: <%=(holdings.TotalValue + holdings.NettingValue < 0) ? "<span style=\"color: red;\">" + String.Format("{0:0,0}", holdings.TradingValue + holdings.NettingValue) + "</span>" : "<span style=\"color: green;\">" + String.Format("{0:0,0}", holdings.TradingValue + holdings.NettingValue) + "</span>"%>
        </th>
        <th class="InnerData" colspan="2">
            Total gain: <%=(holdings.TotalGain < 0) ? "<span style=\"color: red;\">" + String.Format("{0:0,0}", holdings.TotalGain * 1000) + "</span>" : "<span style=\"color: green;\">" + String.Format("{0:0,0}", holdings.TotalGain * 1000) + "</span>"%>
        </th>
    </tr>
    <%}%>
</table>
